<?php

//$client_id = "0000000008fc00000001";
//var_dump(strlen($client_id));
//$i = (int) substr($client_id,strlen($client_id)-1,1);
//var_dump($i);
//exit;
//$token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoi5Luj5LujIiwiaWQiOjIxLCJwaG9uZSI6IjE3MzgxNTg4ODE0IiwibGF0IjoxNTgyMDAwNTQ0LCJleHAiOjE1ODI4NjQ1NDQsInVzZXJfdHlwZSI6MX0.HG7mNJ8CZ7BnAS_dmElI9ARysHM0aKdGPe3gT8wRXnk';
//$data = array(
//
//    'token'=>$token,
//    'type'=>1,
//    'msg_code'=>201
//
//);
//
//$s = (json_encode($data));
//$t = __DIR__."/json.txt";
//$f = fopen($t,'w');
//fwrite($f,$s);
//fclose($f);
//exit;
//include __DIR__ . '/vendor/autoload.php';
//$app = require_once __DIR__ . '/bootstrap/app.php';
//$app->boot();
//$app = new Illuminate\Foundation\Application(
//    realpath(__DIR__.'/../')
//);
//$app->useEnvironmentPath('.env.dev');
//var_dump(env('DB_PORT'));

//
//$order = \App\Models\Order\OrderGoods::all();
//
//var_dump($order->toArray());

require 'vendor/autoload.php';

//
//DB_CONNECTION=mysql
//DB_HOST=server.southmeteor.com
//DB_PORT=3306
//DB_DATABASE=xjfood
//DB_USERNAME=xjfood
//DB_PASSWORD=8bXpLApJ3my4aLmy
//DB_PREFIX=_
//$envFilePath = fopen('.env','r');
//$envName = fread($envFilePath,100);
//fclose($envFilePath);
//$configFilePath = ".env.{$envName}";
//$configFile = fopen($configFilePath,'r');
//$config = fread($configFile,10000);
//$configs = explode('\r',$config);
//var_dump($configs);
$settings = array(
    'driver'    => 'mysql',
    'host'      => 'server.southmeteor.com',
    'database'  => 'xjfood',
    'username'  => 'xjfood',
    'password'  => '8bXpLApJ3my4aLmy',
    'collation' => 'utf8_general_ci',
    'prefix'    => '',
    'charset'	=> 'utf8'
);

$connFactory = new \Illuminate\Database\Connectors\ConnectionFactory(new Illuminate\Container\Container);
$conn = $connFactory->make($settings);

$resolver = new \Illuminate\Database\ConnectionResolver();
$resolver->addConnection('default', $conn);
$resolver->setDefaultConnection('default');

\Illuminate\Database\Eloquent\Model::setConnectionResolver($resolver);


/** use Eloquent **/

use Illuminate\Database\Eloquent\Model as Model;

if(\App\Models\User\UserMessage::where(['id'=>1,'user_id'=>21,'is_confirm'=>0])->exists())

var_dump($data);

